
package com.wwy.monitor.service.impl;

import com.wwy.monitor.mapper.tddl.MonitorConfigIpRelMapper;
import com.wwy.monitor.model.tddl.dto.MonitorConfigIpRelDTO;
import com.wwy.monitor.model.tddl.query.MonitorConfigIpRelQuery;
import com.wwy.monitor.service.MonitorConfigIpRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author long.Wanheng
 * @version V1.00
 * @createDate 2019/11/11
 */
@Service("monitorConfigIpRelService")
public class MonitorConfigIpRelServiceImpl implements MonitorConfigIpRelService {
    @Autowired
    private MonitorConfigIpRelMapper monitorConfigIpRelMapper;

    @Override
    public int batchInsert(List<MonitorConfigIpRelDTO> list) {
        return monitorConfigIpRelMapper.batchInsert(list);
    }

    @Override
    public int deleteById(Long id) {
        return monitorConfigIpRelMapper.deleteById(id);
    }

    @Override
    public int deleteByDetailId(Long detailId) {
        return monitorConfigIpRelMapper.deleteByDetailId(detailId);
    }

    @Override
    public List<MonitorConfigIpRelDTO> selectByQuery(MonitorConfigIpRelQuery query) {
        if (query.getStartTime() != null && query.getEndTime() != null) {
            query.setStartDate(new Date(query.getStartTime()));
            query.setEndDate(new Date(query.getEndTime()));
        }
        return monitorConfigIpRelMapper.selectByQuery(query);
    }
}